package com.zhang.gateway.common.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import reactor.core.publisher.Mono;

import java.util.Objects;

/**
 * description
 *
 * @author zhangFanJun
 * @date 2023-12-04 11:33
 **/
@Slf4j
@Configuration
public class KeyResolverHandler {

    @Bean
    public KeyResolver userKeyResolver(){
        return exchange -> Mono.just(Objects.requireNonNull(exchange.getRequest().getPath().value()));
    }

}
